how to add multiple css style in javascript

72

how to add multiple css style in javascript -

document.getElementById("myElement").style.cssText = "display: block; position: absolute";

//use template literals
document.getElementById("myElement").style.cssText = `
  display: block; 
  position: absolute;
`;

setting multiple css using dom -

document.getElementById("myElement").style.cssText = "display: block; position: absolute";

how to add multiple styles in javascript -

Object.assign(yourelement.style,{fontsize:"12px",left:"200px",top:"100px"});

Comments

Submit
0 Comments